<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('offeringReceipt')} > ${i18n.getMessage('info')}">
	<a href="#" onclick="pp('receipt/printReceipt.sgt?id=${receipt.id}');">Print</a>
	- <a href="#" onclick="cc('study/showListOfferingMember.sgt?offeringId=${receipt.offering.id}')">${i18n.getMessage('list')}</a>
	<#if maintenance??>
		- <a href="#" onclick="cc('receipt/showEditMaintenance.sgt?id=${maintenance.id}')">${i18n.getMessage('maintenance')}</a>
	<#else>
		- <a href="#" onclick="cc('receipt/showAddMaintenance.sgt?receiptId=${receipt.id}')">${i18n.getMessage('addMaintenance')}</a>
	</#if>
	<#if refund??>
		- <a href="#" onclick="cc('receipt/showEditRefund.sgt?id=${refund.id}')">${i18n.getMessage('refund')}</a>
	<#else>
		- <a href="#" onclick="cc('receipt/showAddRefund.sgt?receiptId=${receipt.id}')">${i18n.getMessage('addRefund')}</a>
	</#if>
	- <a href="#" onclick="cc('receipt/showEditOfferingReceipt.sgt?id=${receipt.id}')">${i18n.getMessage('edit')}</a>
	- <a href="#" onclick="if(confirm('${i18n.getMessage('dialog.delete')}')) { cc('receipt/deleteOfferingReceipt.sgt?id=${receipt.id}'); }">${i18n.getMessage('delete')}</a>
</@showTitle>

<table id="dataTable" cellspacing="5" cellpadding="0" align="center">
	<tr>
		<td class="name">${i18n.getMessage('student')}:</td>
		<td><a href="#" onclick="cc('student/showInfoStudent.sgt?id=${receipt.student.id}')" style="color:000">${(receipt.student.fullName)!}</a></td>
	</tr>
	<tr>
		<td class="name">${i18n.getMessage('offering')}:</td>
		<td><a href="#" onclick="cc('offering/showInfoOffering.sgt?id=${receipt.offering.id}')" style="color:000">${(receipt.offering.name)!}</a></td>
	</tr>
	<tr>
		<td class="name">${i18n.getMessage('number')}:</td>
		<td>${(receipt.number)!}</td>
	</tr>
	<tr>
		<td class="name">${i18n.getMessage('date')}:</td>
		<td>${(receipt.date?date)!}</td>
	</tr>
	<tr>
		<td class="name">Discount Items:</td>
		<td>
			<#assign description = "">
			<#list keys as key>
				<#assign items = discountItems(key)>
				<#list items as item>
					<#if item == (receipt.discountItem)!>
						<#assign description = item.getName()>
					</#if>
				</#list>
			</#list>
			<#list amountDiscountItems as item>
				<#if item == (receipt.discountItem)!>
					<#assign description = item.getName()>
				</#if>
			</#list>
			
			<#list keys as key>
				<#assign items = discountItems(key)>
				<#list items as item>
					<#if item == (receipt.discountItem2)!>
						<#assign description = description + ", " + item.getName()>
					</#if>
				</#list>
			</#list>
			<#list amountDiscountItems as item>
				<#if item == (receipt.discountItem2)!>
					<#assign description = description + ", " + item.getName()>
				</#if>
			</#list>
			${description!}
		</td>
	</tr>
	<tr>
		<td class="name">${i18n.getMessage('receipt.type')}:</td>
		<td>
			<#if receipt.submittedTime??>Multi-time<#else>One time</#if>
		</td>
	</tr>
	<#if receipt.expiredDate??>
	<tr>
		<td class="name">${i18n.getMessage('receipt.expiredDate')}:</td>
		<td>${(receipt.expiredDate)?date!}</td>
	</tr>
	</#if>
	<tr>
		<td class="name">${i18n.getMessage('fee')}:</td>
		<td>
			${(receipt.fee.amount!)} ${i18n.getMessage('currency.vnd')}
			<#if receipt.submittedTime??>
				(${(receipt.submittedTime)!})
			</#if>
		</td>
	</tr>
	<tr>
		<td class="name">${i18n.getMessage('cashier')}:</td>
		<td><a href="#" onclick="cc('user/showInfoUser.sgt?id=${receipt.cashier.id}')" style="color:000">${(receipt.cashier.fullName)!}</a></td>
	</tr>
	<tr>
		<td class="name" style="vertical-align:top">${i18n.getMessage('comment')}:</td>
		<td><textarea name="comment" readonly style="width:350px;height:80px;background-color:#FFFAFA">${(receipt.comment)!}</textarea></td>
	</tr>
</table>
